package org.tony.thread.demo;

public class TestThread implements Runnable
{

	public void run()
	{
		System.out.println(Thread.currentThread().getName() + "enter the run method");
		System.out.println("Now will go into synchronization block");

		synchronized (this)
		{
			System.out.println("Synchronized block and sleep 5 second");
			try
			{
				Thread.sleep(5000);
				System.out.println(Thread.currentThread().getName() + "enter the synchronized block");
			}
			catch (InterruptedException e)
			{
				e.printStackTrace();
			}
		}

		System.out.println("out of synchronized block");

	}

}
